const express = require("express");
const bodyParser = require("body-parser");
const register = require("./routers/register");
const login = require("./routers/login");
const hair = require("./routers/hair");
const member=require("./routers/member");
const Cbooking = require("./routers/Customers booking")
const Staff = require("./routers/staff")
const Performance = require("./routers/Performance turnover")
const path = require("path");
const cors = require("cors");
const db=require("./db/index");
const app = express();
app.use("/", async (req, res, next) => {
    await db;
    next();
  });
app.use(express.static(path.join(__dirname, 'public')));
app.use(bodyParser.urlencoded({
    extended: true
}));
app.use(register);
app.use(login);
app.use(hair);
app.use(member);
app.use(Cbooking);
app.use(Staff);
app.use(Performance);
app.use(cors())
app.listen(5000, err => {
    if (!err) console.log("启动成功");
    else console.log(err);
})
